package top.humbleyuan.designmode.subpub;

/**
 * @Author HumbleYuan
 * @Date 2019/12/18 20:26
 * @Des
 */
public class Client {
    public static void main(String[] args) {
        boolean[][] s = new boolean[1][1];
        SubPubPlatform<String> subscribePublish = new SubPubPlatform<>("订阅器");
        IPublisher<String> publisher1 = new PublisherImpl<>("发布者1");
        ISubscriber<String> subscriber1 = new SubscriberImpl<>("订阅者1");
        ISubscriber<String> subscriber2 = new SubscriberImpl<String>("订阅者2");
        subscriber1.sub(subscribePublish);
        subscriber2.sub(subscribePublish);

        publisher1.publish(subscribePublish, "welcome", true);
        publisher1.publish(subscribePublish, "to", true);
        publisher1.publish(subscribePublish, "yy", false);
    }
}
